namespace DotNetNuke.Common.Controls
{
    using DotNetNuke.Security;
    using System;
    using System.IO;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;

    public class Form : HtmlForm
    {
        protected override void RenderAttributes(HtmlTextWriter writer)
        {
            StringWriter stringWriter = new StringWriter();
            HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
            base.RenderAttributes(htmlWriter);
            string html = stringWriter.ToString();
            int StartPoint = html.IndexOf("action=\"");
            if (StartPoint >= 0)
            {
                int EndPoint = html.IndexOf("\"", (int) (StartPoint + 8)) + 1;
                html = html.Remove(StartPoint, EndPoint - StartPoint);
                PortalSecurity objSecurity = new PortalSecurity();
                html = html.Insert(StartPoint, "action=\"" + objSecurity.InputFilter(HttpContext.Current.Request.RawUrl, PortalSecurity.FilterFlag.NoScripting) + "\"");
            }
            if (base.ID != null)
            {
                StartPoint = html.IndexOf("id=\"");
                if (StartPoint >= 0)
                {
                    int EndPoint = html.IndexOf("\"", (int) (StartPoint + 4)) + 1;
                    html = html.Remove(StartPoint, EndPoint - StartPoint).Insert(StartPoint, "id=\"" + base.ClientID + "\"");
                }
            }
            writer.Write(html);
        }
    }
}

